package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                                                                                                        import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.ReduceFeeMapper;
import com.ruoyi.bizsys.domain.ReduceFee;
import com.ruoyi.bizsys.service.IReduceFeeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 减免记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-12-30
 */
@Service
public class ReduceFeeServiceImpl extends ServiceImpl<ReduceFeeMapper,ReduceFee> implements IReduceFeeService {

    /**
     * 查询减免记录
     *
     * @param id 减免记录ID
     * @return 减免记录
     */
    @Override
    public ReduceFee selectReduceFeeById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询减免记录列表
     *
     * @param reduceFee 减免记录
     * @return 减免记录
     */
    @Override
    public List<ReduceFee> selectReduceFeeList(ReduceFee reduceFee) {
        return this.list(new QueryWrapper<>(reduceFee).last("order by id desc"));
    }

    /**
     * 新增减免记录
     *
     * @param reduceFee 减免记录
     * @return 结果
     */
            @Override
    public int insertReduceFee(ReduceFee reduceFee) {
                                                                                                                                                                                                                                                                                                                                                reduceFee.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(reduceFee);
    }

    /**
     * 修改减免记录
     *
     * @param reduceFee 减免记录
     * @return 结果
     */
            @Override
    public int updateReduceFee(ReduceFee reduceFee) {
                                                                                                                                                                                                                                                                                                                                                                                        reduceFee.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(reduceFee);
    }

    /**
     * 批量删除减免记录
     *
     * @param ids 需要删除的减免记录ID
     * @return 结果
     */
            @Override
    public int deleteReduceFeeByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除减免记录信息
     *
     * @param id 减免记录ID
     * @return 结果
     */
    @Override
    public int deleteReduceFeeById(Long id) {
        return baseMapper.deleteById(id);
    }

}
